package cn.bdqn.restful.controller;

import cn.bdqn.restful.entity.UserInfo;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/user")
public class RestFulController {
    @PostMapping
    public String addUser(@RequestBody UserInfo userInfo){
        System.out.println(userInfo);
        return "新增用户成功";
    }

    @DeleteMapping("/{id}")
    public String del(@PathVariable Integer id){
        System.out.println("删除用户ID："+id);
        return "删除用户成功";
    }

    @PostMapping
    public String edit(@RequestBody UserInfo userInfo){
        System.out.println("修改后");
        return "修改用户成功";
    }

    @GetMapping("/{id}")
    public String getByid(@PathVariable Integer id){
        System.out.println("用户ID："+id);
        return "查询用户ID成功！";
    }

    @GetMapping
    public String get(){
        System.out.println("查询所有的用户");
        return "查询所有的用户";
    }
}
